﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

///<summary>
///
///</summary>
public class EndState : State
{
    public override void ExecuteState(StateManager manager)
    {
        if (manager.IsSkipShopPanel)
        {
            ExitState(manager);
        }
        if (manager.IsSkipGameScnen)
        {
            ExitState(manager);
        }
    }

    public override void ExitState(StateManager manager)
    {
        if (manager.IsSkipGameScnen)
        {
            manager.SetState(new GameState());
            manager.IsSkipEndPanel = false;
            SendNotification(GameEvents.REST_GAME);
        }
        if (manager.IsSkipShopPanel)
        {
            manager.SetState(new ShopState());
            AppFacde.Instance.RegisterCommand(GameEvents.SHOP_COMMAND, typeof(ShopCommand));
            SendNotification(GameEvents.SHOP_COMMAND);
        }
    }
    public override void InitState(StateManager manager)
    {
        manager.IsSkipGameScnen = false;
        manager.IsSkipShopPanel = false;
    }
}
